//
//  ChannelCollectionViewCell.m
//  NewMyMusicAPP
//
//  Created by dlios on 15/6/26.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "ChannelCollectionViewCell.h"

@implementation ChannelCollectionViewCell

- (void)dealloc
{
    [_channelModel release];
    [_myImageView release];
    [_myLabel release];
    [super dealloc];
}


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self createSubviews];
    }

    return self;
}


- (void)createSubviews
{
    
    self.myImageView = [[[UIImageView alloc] initWithFrame:self.contentView.bounds]autorelease];
    self.myImageView.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.myImageView];
    
    
    UIView *myView = [[[UIView alloc] initWithFrame:CGRectMake(0, HEIGHT * 160,WIDTH * 185,HEIGHT * 25)]autorelease];
    myView.backgroundColor = [UIColor blackColor];
    myView.alpha = 0.2;
    [self.myImageView addSubview:myView];
    
    
    self.myLabel = [[[UILabel alloc] initWithFrame:CGRectMake(WIDTH * 10,HEIGHT * 160,WIDTH * 150,HEIGHT * 20)]autorelease];
    self.myLabel.backgroundColor = [UIColor clearColor];
    self.myLabel.textColor = [UIColor whiteColor];
    [self.myLabel setFont:[UIFont fontWithName:@"Helvetica-Bold" size:15]];//加粗字体
    [self.myImageView addSubview:self.myLabel];
}

- (void)setChannelModel:(ChannelModel *)channelModel
{
    if (_channelModel != channelModel) {
        [_channelModel release];
        _channelModel = [channelModel retain];
    }
    
    NSURL *url = [NSURL URLWithString:self.channelModel.img];
    [self.myImageView sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"placeHold2.png"]];
    
    self.myLabel.text = self.channelModel.title;
    
}


@end
